/*
 * $Id: XLIStr.h,v 1.2 2006-02-10 05:01:08 bacon Exp $
 */

#ifndef _XPP_XLI_XLISTR_CLASS_
#define _XPP_XLI_XLISTR_CLASS_

#include <xpp/xli/XLIVal.h>
#include <xpp/bas/String.h>

/**
 * @brief Null-terminated string for XLI
 * 
 * Other null xp_char_tacters than the terminating one will be useless 
 * as XLIStr doesn't have any methods to retrieve the length of the actual 
 * string stored. The terminating null xp_char_tacter only delimits its end.
 */
namespace xpp
{
	namespace xli
	{

		class XLIStr: public XLIVal, private bas::String {
		public:
			friend class XLI;
		
			XLIStr (const xp_char_t* str): bas::String (str) {}
			XLIStr (const xp_char_t* str, xp_size_t len): 
				bas::String (str, 0, len) {}
		
			using bas::String::operator==;
			using bas::String::operator!=;
			using bas::String::size;
			using bas::String::length;

			xp_char_t* data () 
			{
				return buffer ();
			}
		
			const xp_char_t* data () const
			{
				return buffer ();
			}

			void setData (const xp_char_t* str) 
			{
				set (str);
			}

			void setData (const xp_char_t* str, xp_size_t len) 
			{
				set (str, 0, len);
			}
		
			XLIVal* copy () 
			{
				//return new XLIStr (_data, _size);
				return new XLIStr (
					this->buffer(), this->length());
			}
		
			bool isStr () const
			{
				return true;
			}

			bool isList () const
			{
				return false;
			}
		};
		
	}
}
#endif
